package com.yricky.fakenote;

import android.app.Activity;
import android.app.AppComponentFactory;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.webkit.WebView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class HelpActivity extends AppCompatActivity {
    WebView webView;
    CheckBox checkBox;
    private SharedPreferences sp;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_help);
        sp= getSharedPreferences("sp",MODE_PRIVATE);
        findViewById(R.id.back_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(HelpActivity.this,MainActivity.class);
                startActivity(intent);
                finish();
            }
        });
        webView=findViewById(R.id.web_help);
        webView.loadUrl("file:///android_asset/help.html");
        checkBox = findViewById(R.id.checkbox_show_toast);
        checkBox.setChecked(sp.getBoolean("toast",true));
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                sp.edit().putBoolean("toast",isChecked).commit();
            }
        });
        TextView textView = findViewById(R.id.textview_pkgname);
        textView.setText(getPackageName());
    }
}
